unit tlgUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TTLG = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Timer1: TTimer;
    Label2: TLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Timer1Timer(Sender: TObject);
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
    Score: Integer;
  end;

var
  TLG: TTLG;

implementation

{$R *.dfm}

procedure TTLG.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TTLG.Timer1Timer(Sender: TObject);
begin
  Image1.Left := Random(Width - Image1.Width);
  Image1.Top := Random(Height - Image1.Height);
  if not Image1.Visible then
    Image1.Visible := True;
end;

procedure TTLG.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Inc(Score);
  Label2.Caption := IntToStr(Score);

  Image1.Left := Random(Width - Image1.Width);
  Image1.Top := Random(Height - Image1.Height);
  Timer1.Enabled := False;
  Timer1.Interval := Timer1.Interval - 100;

  if Timer1.Interval <= 0 then
    ShowMessage('OMG, You must have cheated or don''t have a life. (Although some people claim that that''s the same)');
  Timer1.Enabled := True;
end;

end.
